﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Windows.Forms;

namespace 客户端
{
    public partial class 购买记录 : Form
    {
        string constr = login.constr;
        public static string account;
        DataSet myst = new DataSet();
        SqlDataAdapter myda;
        public 购买记录()
        {
            InitializeComponent();
            SqlConnection sqlcon = new SqlConnection(constr);
            sqlcon.Open();
            string sql = "select gname as 商品名称,gtype as 商品类型,gprice as 商品单价,Coamount as 购买数量,sname as 品牌 ,Cimethod as 支付方式 ,Cidate as 购买时间 from Goods,Corder,Supplier,Cinvoice where Cinvoice.Coid=Corder.Coid and Corder.gid=Supplier.gid and Supplier.gid=Goods.gid and Cinvoice.Caccount='"+account+"' and Costate='已支付' ";
            SqlCommand sqlcmd = new SqlCommand(sql, sqlcon);
            myda = new SqlDataAdapter(sqlcmd);
            myst.Tables.Clear();
            myda.Fill(myst, "B");
            dataGridView1.DataSource = myst.Tables["B"];
        }
    }
}
